cmake_minimum_required(VERSION 2.8.3)
project(trajectory_optimization)
set (CMAKE_CXX_STANDARD 11)
## Add support for C++11, supported in ROS Kinetic and newer
add_definitions(-std=c++11)

find_package(PCL REQUIRED)
find_package(Eigen3 REQUIRED)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  transform_utils
)

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES traj_gen traj_opt
  CATKIN_DEPENDS roscpp
)

include_directories(
  include 
  ${catkin_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
  ${EIGEN3_INCLUDE_DIRS}
)

add_library(traj_gen src/trajectory_generator.cpp)
add_library(traj_opt src/trajectory_optimization.cpp)
target_link_libraries(traj_opt
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
  traj_gen
  /usr/lib/x86_64-linux-gnu/libnlopt.so
)

install(
  TARGETS traj_gen traj_opt
  ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
install(
  DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
